import { ECOption } from "@/components/ECharts/config"
import iconAir from "@/assets/images/icon-air.png"
import iconWater from "@/assets/images/icon-water.png"
import iconGas from "@/assets/images/icon-gas.png"
import iconElectricity from "@/assets/images/icon-electricity.png"
export const statItem = [
  { icon: iconAir, type: 666, label: "合计", value: 0, valueRatio: 0, cost: 0, costRatio: 0, color: "#409EFF" },
  { icon: iconWater, type: 1, label: "峰时间段", value: 0, valueRatio: 0, cost: 0, costRatio: 0, color: "#ffa631" },
  { icon: iconGas, type: 2, label: "平时段", value: 0, valueRatio: 0, cost: 0, costRatio: 0, color: "#f9ed69" },
  { icon: iconElectricity, type: 3, label: "谷时段", value: 0, valueRatio: 0, cost: 0, costRatio: 0, color: "#afdd22" }
]
// 时段电量/电费 数据
export const electricVoltage: ECOption = {
  grid: {
    top: "10%",
    right: "1%",
    bottom: "8%",
    left: "5%"
  },
  color: ["#ffa631", "#f9ed69", "#afdd22"],
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow"
    }
  },
  legend: {
    left: "center"
  },
  xAxis: {
    type: "category",
    data: []
  },
  yAxis: {
    type: "value",
    name: "耗电量（KWH）",
    splitLine: { lineStyle: { type: "dashed" } }
  },
  series: [
    {
      name: "峰",
      data: [],
      type: "bar",
      barWidth: 18,
      stack: "峰"
    },
    {
      name: "平",
      data: [],
      type: "bar",
      barWidth: 18,
      stack: "峰"
    },
    {
      name: "谷",
      data: [],
      type: "bar",
      barWidth: 18,
      stack: "峰"
    }
  ]
}

// 分时峰平谷电量 legend
export const legendItem = [
  { name: "峰", color: "#ffa631" },
  { name: "平", color: "#f9ed69" },
  { name: "谷", color: "#afdd22" }
]
// 分时峰平谷电量
export const bandElectricChart: ECOption = {
  grid: {
    top: "10%",
    right: "1%",
    bottom: "8%",
    left: "10%"
  },
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow"
    },
    formatter: (data: any) => {
      const [item] = data
      const { seriesName, value, name, marker } = item
      return `${name}<br />${marker}${seriesName}：<strong>${value}</strong>`
    }
  },
  xAxis: {
    type: "category",
    data: Array.from({ length: 10 }).map((_, index) => `${index}时`)
  },
  yAxis: {
    type: "value",
    name: "耗电量",
    splitLine: { lineStyle: { type: "dashed" } }
  },
  series: [
    {
      name: "峰",
      data: [],
      type: "bar",
      barWidth: 18,
      color: "#ffa631"
    }
  ]
}
// 分时峰平谷占比图
export const ratioItem = [
  { name: "峰", key: "peakValue", value: 0, unit: "" },
  { name: "平", key: "flatValue", value: 0, unit: "" },
  { name: "谷", key: "valleyValue", value: 0, unit: "" }
]
export const bandRatioChart: ECOption = {
  grid: { top: "15%", right: "5%", bottom: "10%", left: "10%" },
  tooltip: { trigger: "item" },
  legend: { left: "center", icon: "circle" },
  color: ["#ffa631", "#f9ed69", "#afdd22"],
  series: [
    {
      type: "pie",
      top: "10%",
      radius: ["40%", "60%"],
      label: {
        show: true
      },
      data: [],
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: "rgba(0, 0, 0, 0.5)"
        }
      }
    }
  ]
}
